package concurrencyPractice.chapter03;

import concurrencyPractice.GuardBy;
import concurrencyPractice.ThreadSafe;

/**
 * @author xinya
 * @version 1.0
 * @project javacore
 * @description 程序3-3 线程安全的可变整数
 * @date 2023/12/27 10:30:17
 */
@ThreadSafe
public class SynchronizedInteger {
    @GuardBy("this")
    private int value;

    public  synchronized int get() {
        return value;
    }

    public synchronized void set(int value) {
        this.value = value;
    }

}
